<!DOCTYPE html>  
<html>  
<head>  
<title></title>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
<link rel="stylesheet" type="text/css" href="css/sendgame.css"/>
<link rel="stylesheet" type="text/css" href="css/reset.css"/>
<script src="js/jquery.min.js"></script>  
</head>  
<body>  
<div id="sendgame">
	<div id="sendgame-h">
		<h1>发布游戏项目</h1>
						
		<span></span>
		</div>
<div id="sendgame-main">
<form name="form0" id="form0">  
	<table border="0px" cellspacing="12px" cellpadding="">
	<tr><td>用户名</td>
		<td><input type="text" name="username" id="username" value="" /></td>
	</tr>
	<tr><td>游戏项目名称</td>
		<td><input type="text" name="gamename" id="gamename" value="" /></td>
	</tr>
	<tr><td>上传游戏图片</td>
		<td><input type="file" name="file0" id="file0" multiple="multiple" class="inputfile"/>
			<label for="file" class='btn btn-success'>Choose a Image</label>
		</td>  
	</tr>
	<tr><td></td>
		<td><img src="" id="img0" style="width: 20rem;height: 15rem;"></td>
	</tr>
	<tr>
		<td>游戏简介</td>
		<td><textarea name="introduce" rows="9" cols="40"></textarea></td>
	</tr>
	<tr><td>游戏链接</td>
		<td><input type="text" name="link" id="link" value="" /></td>
	</tr>
	<tr><td></td>
		<td>
			<input type="submit" name="submit" id="submit" value="提交" />
		</td>										
	</tr>
</table>
</form>  
</div>
</div>
	
<script>   
$("#file0").change(function(){  
		 var objUrl = getObjectURL(this.files[0]) ;//获取文件信息  
		 console.log("objUrl = "+objUrl);  
		  if (objUrl) {  
		  $("#img0").attr("src", objUrl);  
		 }   
}) ;  
function getObjectURL(file) {  
		 var url = null;   
		 if (window.createObjectURL!=undefined) {  
		  url = window.createObjectURL(file) ;  
		 } else if (window.URL!=undefined) { // mozilla(firefox)  
		  url = window.URL.createObjectURL(file) ;  
		 } else if (window.webkitURL!=undefined) { // webkit or chrome  
		  url = window.webkitURL.createObjectURL(file) ;  
		 }  
		 return url ;  
		}  
		</script>  
</body>  
</html>  